package com.aspose.cells;

class zhc extends zm {
   private zrh a;
   private zrh[] b;
   private double[] c;
   private double d;
   private double e;
   private int f;

   public zhc(Workbook var1, boolean var2) {
      Font var3 = var1.getDefaultStyle().getFont();
      this.a = new zrh(var3.getName(), var3.getSize(), var3.m(), true, (zrh)null);
      double var4 = this.a(this.a);
      zbvx var6 = var1.getWorksheets().B();
      this.b = new zrh[var6.getCount()];
      this.c = new double[this.b.length];
      if (var1.getDefaultStyle().getShrinkToFit()) {
         this.b[0] = null;
      } else {
         this.b[0] = this.a;
      }

      if (var2) {
         this.c[0] = var4;
         this.d = 1.0D;
         this.e = 12.0D * var4;
      } else {
         this.c[0] = 1.0D;
         this.d = var4;
         this.e = 12.0D;
      }

      for(int var7 = 1; var7 < this.c.length; ++var7) {
         if (var6.a(var7).getShrinkToFit()) {
            this.b[var7] = null;
         } else {
            Font var8 = var6.a(var7).q();
            if (var8 != null && !this.a.a(var8.getName(), var8.getSize(), var8.m())) {
               this.b[var7] = new zrh(var8.getName(), var8.getSize(), var8.m(), false, this.a);
               if (var2) {
                  this.c[var7] = this.a(this.b[var7]);
               } else {
                  this.c[var7] = this.a(this.b[var7]) / var4;
               }
            } else {
               this.b[var7] = this.a;
               if (var2) {
                  this.c[var7] = var4;
               } else {
                  this.c[var7] = 1.0D;
               }
            }
         }
      }

   }

   public int a(String var1, char var2) {
      zrh var3 = this.b[this.f];
      return var3 == null ? 1 : (int)((this.e * this.d - (double)(var1 != null && !var1.equals("") ? var3.a(var1) : 0)) / (double)var3.a(var2));
   }

   public int a(String var1, String var2) {
      zrh var3 = this.b[this.f];
      return var3 == null ? 1 : (int)((this.e * this.d - (double)(var1 != null && !var1.equals("") ? var3.a(var1) : 0)) / (double)var3.a(var2));
   }

   public void a(int var1) {
      if (var1 > -1 && var1 < this.b.length) {
         this.f = var1;
      } else {
         this.f = 0;
      }

   }

   public void a(double var1) {
      this.e = var1;
   }

   protected int a(String var1) {
      zrh var2 = this.b[this.f];
      return var2 == null ? 11 : (int)((this.e - (var1 != null && !var1.equals("") ? (double)var2.a(var1) / this.d : 0.0D)) / this.c[this.f]);
   }
}
